home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib / tk / CrtMainWin.man < prev    next >
Encoding:
Text File  |  1992-08-24  |  12.2 KB  |  358 lines

  1. '\"
  2. '\" Copyright 1990 Regents of the University of California
  3. '\" Permission to use, copy, modify, and distribute this
  4. '\" documentation for any purpose and without fee is hereby
  5. '\" granted, provided that this notice appears in all copies.
  6. '\" The University of California makes no representations about
  7. '\" the suitability of this material for any purpose.  It is
  8. '\" provided "as is" without express or implied warranty.
  9. '\" 
  10. '\" $Header: /user6/ouster/wish/man/RCS/CrtMainWin.man,v 1.11 91/12/06 10:38:55 ouster Exp $ SPRITE (Berkeley)
  11. '\" 
  12. .\" The definitions below are for supplemental macros used in Sprite
  13. .\" manual entries.
  14. .\"
  15. .\" .HS name section [date [version]]
  16. .\"    Replacement for .TH in other man pages.  See below for valid
  17. .\"    section names.
  18. .\"
  19. .\" .AP type name in/out [indent]
  20. .\"    Start paragraph describing an argument to a library procedure.
  21. .\"    type is type of argument (int, etc.), in/out is either "in", "out",
  22. .\"    or "in/out" to describe whether procedure reads or modifies arg,
  23. .\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  24. .\"    needed;  use .AS below instead)
  25. .\"
  26. .\" .AS [type [name]]
  27. .\"    Give maximum sizes of arguments for setting tab stops.  Type and
  28. .\"    name are examples of largest possible arguments that will be passed
  29. .\"    to .AP later.  If args are omitted, default tab stops are used.
  30. .\"
  31. .\" .BS
  32. .\"    Start box enclosure.  From here until next .BE, everything will be
  33. .\"    enclosed in one large box.
  34. .\"
  35. .\" .BE
  36. .\"    End of box enclosure.
  37. .\"
  38. .\" .VS
  39. .\"    Begin vertical sidebar, for use in marking newly-changed parts
  40. .\"    of man pages.
  41. .\"
  42. .\" .VE
  43. .\"    End of vertical sidebar.
  44. .\"
  45. .\" .DS
  46. .\"    Begin an indented unfilled display.
  47. .\"
  48. .\" .DE
  49. .\"    End of indented unfilled display.
  50. .\"
  51. '\"    # Heading for Sprite man pages
  52. .de HS
  53. .if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  54. .if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  55. .if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  56. .if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  57. .if t .wh -1.3i ^B
  58. .nr ^l \\n(.l
  59. .ad b
  60. ..
  61. '\"    # Start an argument description
  62. .de AP
  63. .ie !"\\$4"" .TP \\$4
  64. .el \{\
  65. .   ie !"\\$2"" .TP \\n()Cu
  66. .   el          .TP 15
  67. .\}
  68. .ie !"\\$3"" \{\
  69. .ta \\n()Au \\n()Bu
  70. \&\\$1    \\fI\\$2\\fP    (\\$3)
  71. .\".b
  72. .\}
  73. .el \{\
  74. .br
  75. .ie !"\\$2"" \{\
  76. \&\\$1    \\fI\\$2\\fP
  77. .\}
  78. .el \{\
  79. \&\\fI\\$1\\fP
  80. .\}
  81. .\}
  82. ..
  83. '\"    # define tabbing values for .AP
  84. .de AS
  85. .nr )A 10n
  86. .if !"\\$1"" .nr )A \\w'\\$1'u+3n
  87. .nr )B \\n()Au+15n
  88. .\"
  89. .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  90. .nr )C \\n()Bu+\\w'(in/out)'u+2n
  91. ..
  92. '\"    # BS - start boxed text
  93. '\"    # ^y = starting y location
  94. '\"    # ^b = 1
  95. .de BS
  96. .br
  97. .mk ^y
  98. .nr ^b 1u
  99. .if n .nf
  100. .if n .ti 0
  101. .if n \l'\\n(.lu\(ul'
  102. .if n .fi
  103. ..
  104. '\"    # BE - end boxed text (draw box now)
  105. .de BE
  106. .nf
  107. .ti 0
  108. .mk ^t
  109. .ie n \l'\\n(^lu\(ul'
  110. .el \{\
  111. .\"    Draw four-sided box normally, but don't draw top of
  112. .\"    box if the box started on an earlier page.
  113. .ie !\\n(^b-1 \{\
  114. \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  115. .\}
  116. .el \}\
  117. \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  118. .\}
  119. .\}
  120. .fi
  121. .br
  122. .nr ^b 0
  123. ..
  124. '\"    # VS - start vertical sidebar
  125. '\"    # ^Y = starting y location
  126. '\"    # ^v = 1 (for troff;  for nroff this doesn't matter)
  127. .de VS
  128. .mk ^Y
  129. .ie n 'mc \s12\(br\s0
  130. .el .nr ^v 1u
  131. ..
  132. '\"    # VE - end of vertical sidebar
  133. .de VE
  134. .ie n 'mc
  135. .el \{\
  136. .ev 2
  137. .nf
  138. .ti 0
  139. .mk ^t
  140. \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  141. .sp -1
  142. .fi
  143. .ev
  144. .\}
  145. .nr ^v 0
  146. ..
  147. '\"    # Special macro to handle page bottom:  finish off current
  148. '\"    # box/sidebar if in box/sidebar mode, then invoked standard
  149. '\"    # page bottom macro.
  150. .de ^B
  151. .ev 2
  152. 'ti 0
  153. 'nf
  154. .mk ^t
  155. .if \\n(^b \{\
  156. .\"    Draw three-sided box if this is the box's first page,
  157. .\"    draw two sides but no top otherwise.
  158. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  159. .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  160. .\}
  161. .if \\n(^v \{\
  162. .nr ^x \\n(^tu+1v-\\n(^Yu
  163. \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  164. .\}
  165. .bp
  166. 'fi
  167. .ev
  168. .if \\n(^b \{\
  169. .mk ^y
  170. .nr ^b 2
  171. .\}
  172. .if \\n(^v \{\
  173. .mk ^Y
  174. .\}
  175. ..
  176. '\"    # DS - begin display
  177. .de DS
  178. .RS
  179. .nf
  180. .sp
  181. ..
  182. '\"    # DE - end display
  183. .de DE
  184. .fi
  185. .RE
  186. .sp .5
  187. ..
  188. .HS Tk_CreateMainWindow tk
  189. .BS
  190. .SH NAME
  191. Tk_CreateMainWindow, Tk_CreateWindow, Tk_CreateWindowFromPath, Tk_DestroyWindow, Tk_MakeWindowExist \- create or delete window
  192. .SH SYNOPSIS
  193. .nf
  194. \fB#include <tk.h>\fR
  195. .sp
  196. Tk_Window
  197. \fBTk_CreateMainWindow\fR(\fIinterp, screenName, baseName\fR)
  198. .sp
  199. Tk_Window
  200. \fBTk_CreateWindow\fR(\fIinterp, parent, name, topLevScreen\fR)
  201. .sp
  202. Tk_Window
  203. \fBTk_CreateWindowFromPath\fR(\fIinterp, tkwin, pathName, topLevScreen\fR)
  204. .sp
  205. \fBTk_DestroyWindow\fR(\fItkwin\fR)
  206. .sp
  207. \fBTk_MakeWindowExist\fR(\fItkwin\fR)
  208. .SH ARGUMENTS
  209. .AS Tcl_Interp *topLevScreen
  210. .AP Tcl_Interp *interp out
  211. Tcl interpreter to use for error reporting.  If no error occurs,
  212. then \fI*interp\fR isn't modified.  For \fBTk_CreateMainWindow\fR,
  213. this interpreter is associated permanently with the created window,
  214. and Tk-related commands are bound into the interpeter.
  215. .AP char *screenName in
  216. String name of screen on which to create window.  Has the form
  217. \fIdisplayName\fB.\fIscreenNum\fR, where \fIdisplayName\fR is the
  218. name of a display and \fIscreenNum\fR is a screen number.  If
  219. the dot and \fIscreenNum\fR are omitted, the screen number defaults
  220. to 0.  If \fIscreenName\fR is NULL or empty string, defaults to
  221. contents of DISPLAY environment variable.
  222. .AP char *baseName in
  223. Name to use for this main window.  See below for details.
  224. .AP Tk_Window parent in
  225. Token for the window that is to serve as the logical parent of
  226. the new window.
  227. .AP char *name in
  228. Name to use for this window.  Must be unique among all children of
  229. the same \fIparent\fR.
  230. .AP char *topLevScreen in
  231. Has same format as \fIscreenName\fR.  If NULL, then new window is
  232. created as an internal window.  If non-NULL, new window is created as
  233. a top-level window on screen \fItopLevScreen\fR.  If \fItopLevScreen\fR
  234. is an empty string (``'') then new
  235. window is created as top-level window of \fIparent\fR's screen.
  236. .AP Tk_Window tkwin in
  237. Token for window.
  238. .AP char *pathName in
  239. Name of new window, specified as path name within application
  240. (e.g. \fB.a.b.c\fR).
  241. .BE
  242.  
  243. .SH DESCRIPTION
  244. .PP
  245. The three procedures \fBTk_CreateMainWindow\fR, \fBTk_CreateWindow\fR,
  246. and \fBTk_CreateWindowFromPath\fR are used to create new windows for
  247. use in Tk-based applications.  Each of the procedures returns a token
  248. that can be used to manipulate the window in other calls to the Tk
  249. library.  If the window couldn't be created successfully, then NULL
  250. is returned and \fIinterp->result\fR is modified to hold an error
  251. message.
  252. .PP
  253. Tk supports three different kinds of windows:  main windows, internal
  254. windows, and top-level windows.
  255. A main window is the outermost window corresponding to an application.
  256. Main windows correspond to the independent units of an application,
  257. such as a view on a file that is part of an editor, or a clock, or
  258. a terminal emulator.  A main window is created as a child of the root
  259. window of the screen indicated by the \fIscreenName\fR.  Each main
  260. window, and all its descendants, are typically associated with a
  261. single Tcl command interpreter, given by the \fIinterp\fR argument
  262. to \fBTk_CreateMainWindow\fR.  \fBTk_CreateMainWindow\fR adds all the
  263. Tk-related commands to those already defined for \fIinterp\fR.
  264. .PP
  265. \fBTk_CreateMainWindow\fR also registers \fIinterp\fR so that it
  266. can be accessed remotely by other Tk applications using the \fBsend\fR
  267. command and the name \fIbaseName\fR.  Normally, \fIbaseName\fR consists
  268. of the name of the application followed by a space and an identifier for this
  269. particular main window (if such an identifier is relevant).  For example,
  270. an editor named \fBmx\fR displaying the file \fBfoo.c\fR would use
  271. ``mx foo.c'' as the basename.  An application that doesn't usually
  272. have multiple instances, such as a clock program, would just use the
  273. name of the application, e.g. ``xclock''.  If \fIbaseName\fR is already
  274. in use by some other registered interpreter, then \fBTk_CreateMainWindow\fR
  275. extends \fIbaseName\fR with a number to produce a unique name like
  276. ``mx foo.c #2'' or ``xclock #12''.  This name is used both as the name
  277. of the window (returned by \fBTk_Name\fR) and as the registered name
  278. of the interpreter.
  279. .PP
  280. An internal window is an interior window of a Tk application, such as a
  281. scrollbar or menu bar or button.  A top-level window is one that is
  282. created as a child of a screen's root window, rather than as an
  283. interior window, but which is logically part of some existing main
  284. window.  Examples of top-level windows are pop-up menus and dialog boxes.
  285. .PP
  286. Either internal or top-level windows may be created by calling
  287. \fBTk_CreateWindow\fR.  If the \fItopLevScreen\fR argument is
  288. NULL, then the new window will be an internal window.  If
  289. \fItopLevScreen\fR is non-NULL, then the new window will be a
  290. top-level window: \fItopLevScreen\fR indicates the name of
  291. a screen and the new window will be created as a child of the
  292. root window of \fItopLevScreen\fR.  In either case Tk will
  293. consider the new window to be the logical child of \fIparent\fR:
  294. the new window's path name will reflect this fact, options may
  295. be specified for the new window under this assumption, and so on.
  296. The only difference is that new X window for a top-level window
  297. will not be a child of \fIparent\fR's X window.  For example, a pull-down
  298. menu's \fIparent\fR would be the button-like window used to invoke it,
  299. which would in turn be a child of the menu bar window.  A dialog box might
  300. have the application's main window as its parent.  This approach
  301. means that all the windows of an application fall into a hierarchical
  302. arrangement with a single logical root:  the application's main window.
  303. .PP
  304. \fBTk_CreateWindowFromPath\fR offers an alternate way of specifying
  305. new windows.  In \fBTk_CreateWindowFromPath\fR the new
  306. window is specified with a token for any window in the target
  307. application (\fItkwin\fR), plus a path name for the new window.
  308. It produces the same effect as \fBTk_CreateWindow\fR and allows
  309. both top-level and internal windows to be created, depending on
  310. the value of \fItopLevScreen\fR.  In calls to \fBTk_CreateWindowFromPath\fR,
  311. as in calls to \fBTk_CreateWindow\fR, the parent of the new window
  312. must exist at the time of the call, but the new window must not
  313. already exist.
  314. .PP
  315. In truth, the window-creation procedures don't
  316. actually issue the command to X to create a window.
  317. Instead, they create a local data structure associated with
  318. the window and defer issuing the command to X.  The
  319. window will actually be created by the first call to
  320. \fBTk_MapWindow\fR.  Deferred window creation allows various
  321. aspects of the window (such as its size, background color,
  322. etc.) to be modified after its creation without incurring
  323. any overhead in the X server.  When the window is finally
  324. mapped all of the window attributes can be set while creating
  325. the window.
  326. .PP
  327. The value returned by a window-creation procedure is not the
  328. X token for the window (it can't be, since X hasn't been
  329. asked to create the window yet).  Instead, it is a token
  330. for Tk's local data structure for the window.  Most
  331. of the Tk library procedures take Tk_Window tokens, rather
  332. than X identifiers.  The actual
  333. X window identifier can be retrieved from the local
  334. data structure using the \fBTk_WindowId\fR macro;  see
  335. the manual entry for \fBTk_WindowId\fR for details.
  336. .PP
  337. \fBTk_DestroyWindow\fR deletes a window and all the data
  338. strutures associated with it, including any event handlers
  339. created with \fBTk_CreateEventHandler\fR.  In addition,
  340. \fBTk_DestroyWindow\fR will delete any children of \fItkwin\fR
  341. recursively (where children are defined in the Tk sense, consisting
  342. of all windows that were created with the given window as \fIparent\fR).
  343. If \fItkwin\fR was created by \fBTk_CreateInternalWindow\fR then event
  344. handlers interested in destroy events
  345. are invoked immediately.  If \fItkwin\fR is a top-level or main window,
  346. then the event handlers will be invoked later, after X has seen
  347. the request and returned an event for it.
  348. .PP
  349. If a window has been created
  350. but hasn't been mapped, so no X window exists, it is
  351. possible to force the creation of the X window by
  352. calling \fBTk_MakeWindowExist\fR.  This procedure issues
  353. the X commands to instantiate the window given by \fItkwin\fR.
  354.  
  355. .SH KEYWORDS
  356. create, deferred creation, destroy, display, internal window, main window,
  357. register, screen, top-level window, window
  358.